<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>预付款记录审核</title>
    <jsp:include page="../../head.jsp"/>
</head>
<script type="text/javascript">
    var allFundState = ${allFundState};
    var formSetting = {
        title: "预付款记录",
        module: 'query',
        numCount: '2',
        columns: [{
            index: "OWNER_NAME",
            name: "owner.name",
            label: "预付款公司"
        }, {
            index: "BID",
            name: "bid",
            label: "预付款编号"
        }, {
            index: "STATUS",
            name: "state",
            type: "dropdown",
            data: allFundState,
            label: "预付款状态"
        }, {
            index: "REGDATE",
            name: "regDate",
            type: "date",
            label: "预付款时间起",
            op: "ge"
        }, {
            index: "REGDATE",
            name: "regDate",
            label: "预付款时间止",
            type: "date",
            op: "le"
        }, {
            index: "REVIEWDATE",
            name: "reviewDate",
            type: "date",
            label: "审核时间起",
            op: "ge"
        }, {
            index: "REVIEWDATE",
            name: "reviewDate",
            label: "审核时间止",
            type: "date",
            op: "le"
        }],
        buttons: {
            custom: [{
                id: "updatebtn",
                value: "查看并审核",
                click: function () {
                    var id = $("#dataGrid").jqGrid(
                            "getGridParam", "selrow");
                    if (id) {
                        //jw.confirm("确定要删除选择的项?", function() {
                        var ret = $("#dataGrid").jqGrid(
                                'getRowData', id);
                        window.location.href = "ajustment-reviewer_view?id=" + ret.id;
                        //}, function() {
                        //	return;
                        //});
                    } else {
                        jw.alert("请先点击选择需要审核的记录!");
                    }
                }
            }]
        },
        grid: {
            id: "dataGrid",
            title: "查询结果",
            url: "ajustment-findReviewerList",
            colModel: [{
                index: "id",
                name: "id",
                label: "id",
                hidden: true
            }, {
                index: "owner_name",
                name: "owner.name",
                label: "预付款公司"
            }, {
                index: "bid",
                name: "bid",
                label: "预付款编号"
            }, {
                index: "amount",
                name: "amount",
                label: "预付款金额"
            }, {
                index: "state",
                name: "state",
                label: "预付款状态"
            }, {
                index: "regDate",
                name: "regDate",
                formatter: 'date',
                formatoptions: {
                    srcformat: 'Y-m-d H:i:s',
                    newformat: 'Y-m-d H:i:s'
                },
                label: "录入时间"
            }, {
                index: "registrant.name",
                name: "registrant.name",
                label: "提交人"
            }, {
                index: "reviewDate",
                name: "reviewDate",
                formatter: 'date',
                formatoptions: {
                    srcformat: 'Y-m-d H:i:s',
                    newformat: 'Y-m-d H:i:s'
                },
                label: "审核时间"
            }, {
                index: "reviewer.name",
                name: "reviewer.name",
                label: "审核人"
            }],
            sortname: "regDate",
            sortorder: "desc",
            jsonReader: {
//                root: "datas"
            },
            loadComplete: function (data) {
                $("td[aria-describedby='dataGrid_state']").each(function () {
                    $(this).text(stateUtil.get(allFundState, $(this).text()));
                });
            }
        }
    };
    $(document).ready(function () {
        $("#dataTable").mrdForm(formSetting);
    });
    var stateUtil = {
        get: function (arras, key) {
            for (var a in arras) {
                if (arras[a][1] == key) {
                    return arras[a][0];
                }
            }
        }
    }
</script>
<body>
<div id="dataTable"></div>
</body>
</html>
